//#define __DEBUG__
#define THIS_FILE "fn_hmousebuttons.sqf"
#include "x_setup.sqf"

KEGs_mousecheckon = true;
while {(KEGs_MouseButtons select 0) || {(KEGs_MouseButtons select 1)}} do {		
	if (!(KEGs_MouseButtons select 0) && {(KEGs_MouseButtons select 1)}) then {
		KEGs_fangle = KEGs_fangle - ((KEGs_mouseDeltaPos select 0) * 360);
		KEGs_fangleY = KEGs_fangleY + ((KEGs_mouseDeltaPos select 1) * 180);
		if (KEGs_fangleY > 89) then {
			KEGs_fangleY = 89
		} else {
			if (KEGs_fangleY < -89) then {KEGs_fangleY = -89};
		};
	} else {
		if ((KEGs_MouseButtons select 0) && {!(KEGs_MouseButtons select 1)}) then {
			KEGs_sdistance = KEGs_sdistance - ((KEGs_mouseDeltaPos select 1) * 10);
			if (KEGs_sdistance > KEGs_maxDistance) then {
				KEGs_sdistance = KEGs_maxDistance
			} else {
				if (KEGs_sdistance < -KEGs_maxDistance) then {KEGs_sdistance = -KEGs_maxDistance};
			};
			if (KEGs_sdistance < -0.6) then {KEGs_sdistance = -0.6};
		} else {
			if ((KEGs_MouseButtons select 0) && {(KEGs_MouseButtons select 1)}) then {
				KEGs_szoom = KEGs_szoom - ((KEGs_mouseDeltaPos select 1) * 3);
				if (KEGs_szoom > 2) then {
					KEGs_szoom = 2
				} else {
					if (KEGs_szoom < 0.05) then {KEGs_szoom = 0.05};
				};
			};
		};
	};
	
	if (KEGs_exitspect) exitWith {};
	sleep 0.0034;
};
KEGs_mousecheckon = false;